package com.bitrate.dagger.server.websocket.handler;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Component;

import com.bitrate.dagger.sdk.websocket.enums.PushBizType;

@Component
public class WebSocketStrategyContext {

	private List<WebSocketStrategyHandler> bizHandleArr = new ArrayList<WebSocketStrategyHandler>();

	public void regisiter(WebSocketStrategyHandler handle) {
		bizHandleArr.add(handle);
	}

	public WebSocketStrategyHandler getHandle(PushBizType type) {
		return bizHandleArr.stream().filter(h -> h.init(type)).findFirst().orElse(null);
	}

}
